package com.duoduo.springboot.security.vo;

import org.springframework.beans.BeanUtils;

import com.duoduo.springboot.security.model.Role;

/**
 * 角色VO
 * @author cgs1999@126.com
 * @date 2018年5月6日 下午8:50:17
 * @version 1.0.0
 */
public class RoleVO extends BaseVO<Integer> {

	private static final long serialVersionUID = -4333847815210190203L;
	private String name;

	public RoleVO() {

	}

	public RoleVO(Integer id, String name) {
		setId(id);
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Entity转VO
	 * @param entity
	 * @return
	 */
	public static RoleVO fromEntity(Role entity) {
		RoleVO vo = new RoleVO();
		BeanUtils.copyProperties(entity, vo);
		return vo;
	}

	/**
	 * VO转Entity
	 * @param vo
	 * @return
	 */
	public static Role fromEntity(RoleVO vo) {
		Role entity = new Role();
		BeanUtils.copyProperties(vo, entity);
		return entity;
	}
}
